{extend name="property/public/insidePageBase" /}
{block name="title"}编辑短信模板{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form layui-form-pane">
            <div class="layui-form-item" pane="">
                <label class="layui-form-label">启用状态</label>
                <div class="layui-input-block">
                    <input type="radio" name="is_show" value="1"  {if isset($info['is_show']) && $info['is_show'] == 1}checked{/if} title="开启" >
                    <input type="radio" name="is_show" value="2"  {if isset($info['is_show']) && $info['is_show'] == 2}checked{/if} title="关闭" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">短信类型</label>
                <div class="layui-input-block">
                    <select name="sms_type" id="sms_type" lay-filter="sms_type" disabled>
                        <option value="">请选择</option>
                        {foreach $templateTypes as $k=>$v}
                            <option value="{$k}" {if $info['sms_type'] == $k}selected{/if}>{$v['name']}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">模板ID</label>
                <div class="layui-input-block">
                    <input type="text" name="template_id" value="{$info['template_id']}" placeholder="请输入模板ID" class="layui-input" autocomplete="off"/>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">短信内容</label>
                <div class="layui-input-block">
                    <textarea name="content" class="layui-textarea" placeholder="请输入短信内容">{$info['content']}</textarea>
                    <div class="layui-form-mid layui-word-aux" id="template_content_prompt"></div>
                </div>
            </div>
            <div class="layui-form-item layui-hide">
                <button class="layui-btn" lay-submit lay-filter="submitBtn" id="submitBtn">提交</button>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
<script>
    layui.use('form', function () {
        var form = layui.form;
        var templateDesc = {:json_encode($templateTypes, JSON_UNESCAPED_UNICODE)};
        form.on('select(sms_type)', function(data){
            $('#template_content_prompt').html(templateDesc[data.value] ? templateDesc[data.value]['template_tips'] : '');
        });
        $('#template_content_prompt').html(templateDesc[{$info['sms_type']}] ? templateDesc[{$info['sms_type']}]['template_tips'] : '');
    });
</script>
{/block}